package com.zt.questionnaire.controller;

import cn.binarywang.wx.miniapp.api.WxMaService;
import com.zt.questionnaire.common.config.redis.CacheOperator;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 微信小程序用户接口
 *
 * @author <a href="https://github.com/binarywang">Binary Wang</a>
 */
@RestController
@AllArgsConstructor
@Slf4j
@RequestMapping("/test")
public class TestController {
    private final WxMaService wxMaService;

    @Autowired
    private CacheOperator redis;

    @GetMapping("/set")
    public String set() {
        redis.setString("k1", "test");
        return "1";
    }

    @GetMapping("/get")
    public String get() {
        String k1 = redis.getString("k1");
        return k1;
    }
}
